.class public Lcom/opongo/blogapp/activities/CommentsListActivity;
.super Landroid/app/ListActivity;
.source "CommentsListActivity.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/opongo/blogapp/activities/CommentsListActivity$downloadCommentsAsyncTask;
    }
.end annotation


# static fields
.field public static final DEBUG:Z

.field private static final TAG:Ljava/lang/String;


# instance fields
.field private apiManager:Lcom/opongo/blogapp/manager/APIManager;

.field private comments:Ljava/util/ArrayList;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/ArrayList",
            "<",
            "Lcom/opongo/blogapp/common/Comment;",
            ">;"
        }
    .end annotation
.end field

.field private dbManager:Lcom/opongo/blogapp/manager/DatabaseManager;

.field downloadComments:Landroid/os/AsyncTask;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Landroid/os/AsyncTask",
            "<",
            "Ljava/lang/Void;",
            "Ljava/lang/Void;",
            "Ljava/lang/Void;",
            ">;"
        }
    .end annotation
.end field

.field private footerView:Landroid/view/View;

.field private mAdapter:Lcom/opongo/blogapp/adapter/CommentViewAdapter;

.field private postid:I

.field private receiver:Landroid/content/BroadcastReceiver;

.field private receiver2:Landroid/content/BroadcastReceiver;

.field private tableName:Ljava/lang/String;


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 33
    sget-boolean v0, Lcom/opongo/blogapp/AbaSettings;->DEBUG:Z

    sput-boolean v0, Lcom/opongo/blogapp/activities/CommentsListActivity;->DEBUG:Z

    .line 34
    const-class v0, Lcom/opongo/blogapp/activities/CommentsListActivity;

    .line 35
    invoke-virtual {v0}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;

    move-result-object v0

    .line 34
    sput-object v0, Lcom/opongo/blogapp/activities/CommentsListActivity;->TAG:Ljava/lang/String;

    .line 30
    return-void
.end method

.method public constructor <init>()V
    .locals 1

    .prologue
    .line 30
    invoke-direct {p0}, Landroid/app/ListActivity;-><init>()V

    .line 40
    const/4 v0, -0x1

    iput v0, p0, Lcom/opongo/blogapp/activities/CommentsListActivity;->postid:I

    .line 30
    return-void
.end method

.method static synthetic access$0()Ljava/lang/String;
    .locals 1

    .prologue
    .line 34
    sget-object v0, Lcom/opongo/blogapp/activities/CommentsListActivity;->TAG:Ljava/lang/String;

    return-object v0
.end method

.method static synthetic access$1(Lcom/opongo/blogapp/activities/CommentsListActivity;)Lcom/opongo/blogapp/manager/APIManager;
    .locals 1
    .parameter

    .prologue
    .line 38
    iget-object v0, p0, Lcom/opongo/blogapp/activities/CommentsListActivity;->apiManager:Lcom/opongo/blogapp/manager/APIManager;

    return-object v0
.end method

.method static synthetic access$2(Lcom/opongo/blogapp/activities/CommentsListActivity;)I
    .locals 1
    .parameter

    .prologue
    .line 40
    iget v0, p0, Lcom/opongo/blogapp/activities/CommentsListActivity;->postid:I

    return v0
.end method

.method static synthetic access$3(Lcom/opongo/blogapp/activities/CommentsListActivity;Ljava/util/ArrayList;)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 39
    iput-object p1, p0, Lcom/opongo/blogapp/activities/CommentsListActivity;->comments:Ljava/util/ArrayList;

    return-void
.end method

.method static synthetic access$4(Lcom/opongo/blogapp/activities/CommentsListActivity;)Ljava/util/ArrayList;
    .locals 1
    .parameter

    .prologue
    .line 39
    iget-object v0, p0, Lcom/opongo/blogapp/activities/CommentsListActivity;->comments:Ljava/util/ArrayList;

    return-object v0
.end method

.method static synthetic access$5(Lcom/opongo/blogapp/activities/CommentsListActivity;Ljava/util/ArrayList;Ljava/util/ArrayList;Lcom/opongo/blogapp/common/Comment;)Ljava/util/ArrayList;
    .locals 1
    .parameter
    .parameter
    .parameter
    .parameter

    .prologue
    .line 135
    invoke-direct {p0, p1, p2, p3}, Lcom/opongo/blogapp/activities/CommentsListActivity;->sortComment(Ljava/util/ArrayList;Ljava/util/ArrayList;Lcom/opongo/blogapp/common/Comment;)Ljava/util/ArrayList;

    move-result-object v0

    return-object v0
.end method

.method static synthetic access$6(Lcom/opongo/blogapp/activities/CommentsListActivity;)V
    .locals 0
    .parameter

    .prologue
    .line 226
    invoke-direct {p0}, Lcom/opongo/blogapp/activities/CommentsListActivity;->reloadComments()V

    return-void
.end method

.method static synthetic access$7(Lcom/opongo/blogapp/activities/CommentsListActivity;)V
    .locals 0
    .parameter

    .prologue
    .line 199
    invoke-direct {p0}, Lcom/opongo/blogapp/activities/CommentsListActivity;->showAlertNoComments()V

    return-void
.end method

.method static synthetic access$8(Lcom/opongo/blogapp/activities/CommentsListActivity;)V
    .locals 0
    .parameter

    .prologue
    .line 295
    invoke-direct {p0}, Lcom/opongo/blogapp/activities/CommentsListActivity;->writeComment()V

    return-void
.end method

.method static synthetic access$9(Lcom/opongo/blogapp/activities/CommentsListActivity;)Lcom/opongo/blogapp/adapter/CommentViewAdapter;
    .locals 1
    .parameter

    .prologue
    .line 37
    iget-object v0, p0, Lcom/opongo/blogapp/activities/CommentsListActivity;->mAdapter:Lcom/opongo/blogapp/adapter/CommentViewAdapter;

    return-object v0
.end method

.method private reloadComments()V
    .locals 6

    .prologue
    .line 227
    new-instance v1, Ljava/util/ArrayList;

    invoke-direct {v1}, Ljava/util/ArrayList;-><init>()V

    .line 228
    .local v1, sortedCommentsArray:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Lcom/opongo/blogapp/common/Comment;>;"
    iget-object v2, p0, Lcom/opongo/blogapp/activities/CommentsListActivity;->comments:Ljava/util/ArrayList;

    invoke-virtual {v2}, Ljava/util/ArrayList;->size()I

    move-result v2

    if-eqz v2, :cond_0

    .line 229
    iget-object v2, p0, Lcom/opongo/blogapp/activities/CommentsListActivity;->comments:Ljava/util/ArrayList;

    const/4 v3, 0x0

    invoke-direct {p0, v2, v1, v3}, Lcom/opongo/blogapp/activities/CommentsListActivity;->sortComment(Ljava/util/ArrayList;Ljava/util/ArrayList;Lcom/opongo/blogapp/common/Comment;)Ljava/util/ArrayList;

    .line 231
    :cond_0
    iput-object v1, p0, Lcom/opongo/blogapp/activities/CommentsListActivity;->comments:Ljava/util/ArrayList;

    .line 232
    iget-object v2, p0, Lcom/opongo/blogapp/activities/CommentsListActivity;->mAdapter:Lcom/opongo/blogapp/adapter/CommentViewAdapter;

    invoke-virtual {v2}, Lcom/opongo/blogapp/adapter/CommentViewAdapter;->clear()V

    .line 234
    iget-object v2, p0, Lcom/opongo/blogapp/activities/CommentsListActivity;->comments:Ljava/util/ArrayList;

    invoke-virtual {v2}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator;

    move-result-object v2

    :goto_0
    invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z

    move-result v3

    if-nez v3, :cond_2

    .line 238
    iget-object v2, p0, Lcom/opongo/blogapp/activities/CommentsListActivity;->mAdapter:Lcom/opongo/blogapp/adapter/CommentViewAdapter;

    invoke-virtual {v2}, Lcom/opongo/blogapp/adapter/CommentViewAdapter;->notifyDataSetChanged()V

    .line 240
    invoke-virtual {p0}, Lcom/opongo/blogapp/activities/CommentsListActivity;->getListView()Landroid/widget/ListView;

    move-result-object v2

    iget-object v3, p0, Lcom/opongo/blogapp/activities/CommentsListActivity;->footerView:Landroid/view/View;

    invoke-virtual {v2, v3}, Landroid/widget/ListView;->addFooterView(Landroid/view/View;)V

    .line 242
    iget-object v2, p0, Lcom/opongo/blogapp/activities/CommentsListActivity;->dbManager:Lcom/opongo/blogapp/manager/DatabaseManager;

    if-eqz v2, :cond_1

    .line 243
    iget-object v2, p0, Lcom/opongo/blogapp/activities/CommentsListActivity;->dbManager:Lcom/opongo/blogapp/manager/DatabaseManager;

    iget v3, p0, Lcom/opongo/blogapp/activities/CommentsListActivity;->postid:I

    const-string v4, "commentscount"

    iget-object v5, p0, Lcom/opongo/blogapp/activities/CommentsListActivity;->comments:Ljava/util/ArrayList;

    invoke-virtual {v5}, Ljava/util/ArrayList;->size()I

    move-result v5

    invoke-static {v5}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v5

    invoke-virtual {v2, v3, v4, v5}, Lcom/opongo/blogapp/manager/DatabaseManager;->updatePostByColumn(ILjava/lang/String;Ljava/lang/String;)I

    .line 245
    :cond_1
    return-void

    .line 234
    :cond_2
    invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/opongo/blogapp/common/Comment;

    .line 235
    .local v0, comment:Lcom/opongo/blogapp/common/Comment;
    iget-object v3, p0, Lcom/opongo/blogapp/activities/CommentsListActivity;->mAdapter:Lcom/opongo/blogapp/adapter/CommentViewAdapter;

    invoke-virtual {v3, v0}, Lcom/opongo/blogapp/adapter/CommentViewAdapter;->add(Ljava/lang/Object;)V

    goto :goto_0
.end method

.method private showAlertNoComments()V
    .locals 3

    .prologue
    .line 200
    new-instance v1, Landroid/app/AlertDialog$Builder;

    invoke-direct {v1, p0}, Landroid/app/AlertDialog$Builder;-><init>(Landroid/content/Context;)V

    invoke-virtual {v1}, Landroid/app/AlertDialog$Builder;->create()Landroid/app/AlertDialog;

    move-result-object v0

    .line 201
    .local v0, alertDialog:Landroid/app/AlertDialog;
    const v1, 0x7f070026

    invoke-virtual {p0, v1}, Lcom/opongo/blogapp/activities/CommentsListActivity;->getString(I)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/app/AlertDialog;->setTitle(Ljava/lang/CharSequence;)V

    .line 202
    const v1, 0x7f070027

    invoke-virtual {p0, v1}, Lcom/opongo/blogapp/activities/CommentsListActivity;->getString(I)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/app/AlertDialog;->setMessage(Ljava/lang/CharSequence;)V

    .line 203
    const v1, 0x7f020009

    invoke-virtual {v0, v1}, Landroid/app/AlertDialog;->setIcon(I)V

    .line 205
    const v1, 0x7f07000b

    invoke-virtual {p0, v1}, Lcom/opongo/blogapp/activities/CommentsListActivity;->getString(I)Ljava/lang/String;

    move-result-object v1

    .line 206
    new-instance v2, Lcom/opongo/blogapp/activities/CommentsListActivity$4;

    invoke-direct {v2, p0}, Lcom/opongo/blogapp/activities/CommentsListActivity$4;-><init>(Lcom/opongo/blogapp/activities/CommentsListActivity;)V

    .line 205
    invoke-virtual {v0, v1, v2}, Landroid/app/AlertDialog;->setButton(Ljava/lang/CharSequence;Landroid/content/DialogInterface$OnClickListener;)V

    .line 211
    const v1, 0x7f07000c

    invoke-virtual {p0, v1}, Lcom/opongo/blogapp/activities/CommentsListActivity;->getString(I)Ljava/lang/String;

    move-result-object v1

    .line 212
    new-instance v2, Lcom/opongo/blogapp/activities/CommentsListActivity$5;

    invoke-direct {v2, p0}, Lcom/opongo/blogapp/activities/CommentsListActivity$5;-><init>(Lcom/opongo/blogapp/activities/CommentsListActivity;)V

    .line 211
    invoke-virtual {v0, v1, v2}, Landroid/app/AlertDialog;->setButton2(Ljava/lang/CharSequence;Landroid/content/DialogInterface$OnClickListener;)V

    .line 217
    invoke-virtual {v0}, Landroid/app/AlertDialog;->show()V

    .line 218
    return-void
.end method

.method private showGenericAlert()V
    .locals 3

    .prologue
    .line 268
    new-instance v1, Landroid/app/AlertDialog$Builder;

    invoke-direct {v1, p0}, Landroid/app/AlertDialog$Builder;-><init>(Landroid/content/Context;)V

    invoke-virtual {v1}, Landroid/app/AlertDialog$Builder;->create()Landroid/app/AlertDialog;

    move-result-object v0

    .line 269
    .local v0, alertDialog:Landroid/app/AlertDialog;
    const v1, 0x7f070024

    invoke-virtual {p0, v1}, Lcom/opongo/blogapp/activities/CommentsListActivity;->getString(I)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/app/AlertDialog;->setTitle(Ljava/lang/CharSequence;)V

    .line 270
    const v1, 0x7f070025

    invoke-virtual {p0, v1}, Lcom/opongo/blogapp/activities/CommentsListActivity;->getString(I)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/app/AlertDialog;->setMessage(Ljava/lang/CharSequence;)V

    .line 271
    const v1, 0x7f020009

    invoke-virtual {v0, v1}, Landroid/app/AlertDialog;->setIcon(I)V

    .line 273
    const-string v1, "OK"

    new-instance v2, Lcom/opongo/blogapp/activities/CommentsListActivity$6;

    invoke-direct {v2, p0}, Lcom/opongo/blogapp/activities/CommentsListActivity$6;-><init>(Lcom/opongo/blogapp/activities/CommentsListActivity;)V

    invoke-virtual {v0, v1, v2}, Landroid/app/AlertDialog;->setButton(Ljava/lang/CharSequence;Landroid/content/DialogInterface$OnClickListener;)V

    .line 279
    invoke-virtual {v0}, Landroid/app/AlertDialog;->show()V

    .line 280
    return-void
.end method

.method private sortComment(Ljava/util/ArrayList;Ljava/util/ArrayList;Lcom/opongo/blogapp/common/Comment;)Ljava/util/ArrayList;
    .locals 5
    .parameter
    .parameter
    .parameter "comment"
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/ArrayList",
            "<",
            "Lcom/opongo/blogapp/common/Comment;",
            ">;",
            "Ljava/util/ArrayList",
            "<",
            "Lcom/opongo/blogapp/common/Comment;",
            ">;",
            "Lcom/opongo/blogapp/common/Comment;",
            ")",
            "Ljava/util/ArrayList",
            "<",
            "Lcom/opongo/blogapp/common/Comment;",
            ">;"
        }
    .end annotation

    .prologue
    .line 136
    .local p1, comments:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Lcom/opongo/blogapp/common/Comment;>;"
    .local p2, sortedComments:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Lcom/opongo/blogapp/common/Comment;>;"
    const/4 v1, 0x0

    .line 137
    .local v1, root:Z
    if-nez p3, :cond_0

    .line 138
    const/4 v2, 0x0

    invoke-virtual {p1, v2}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object p3

    .end local p3
    check-cast p3, Lcom/opongo/blogapp/common/Comment;

    .line 139
    .restart local p3
    const/4 v1, 0x1

    .line 142
    :cond_0
    invoke-virtual {p1}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator;

    move-result-object v2

    :cond_1
    :goto_0
    invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z

    move-result v3

    if-nez v3, :cond_2

    .line 152
    return-object p2

    .line 142
    :cond_2
    invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/opongo/blogapp/common/Comment;

    .line 143
    .local v0, c:Lcom/opongo/blogapp/common/Comment;
    if-eqz v1, :cond_3

    iget v3, v0, Lcom/opongo/blogapp/common/Comment;->parent:I

    if-nez v3, :cond_3

    .line 144
    invoke-virtual {p2, v0}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    .line 145
    invoke-direct {p0, p1, p2, v0}, Lcom/opongo/blogapp/activities/CommentsListActivity;->sortComment(Ljava/util/ArrayList;Ljava/util/ArrayList;Lcom/opongo/blogapp/common/Comment;)Ljava/util/ArrayList;

    goto :goto_0

    .line 146
    :cond_3
    iget v3, p3, Lcom/opongo/blogapp/common/Comment;->id:I

    iget v4, v0, Lcom/opongo/blogapp/common/Comment;->parent:I

    if-ne v3, v4, :cond_1

    invoke-virtual {p2, v0}, Ljava/util/ArrayList;->contains(Ljava/lang/Object;)Z

    move-result v3

    if-nez v3, :cond_1

    .line 147
    invoke-virtual {p2, v0}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    .line 148
    invoke-direct {p0, p1, p2, v0}, Lcom/opongo/blogapp/activities/CommentsListActivity;->sortComment(Ljava/util/ArrayList;Ljava/util/ArrayList;Lcom/opongo/blogapp/common/Comment;)Ljava/util/ArrayList;

    goto :goto_0
.end method

.method private writeComment()V
    .locals 3

    .prologue
    .line 296
    new-instance v0, Landroid/content/Intent;

    .line 297
    const-class v1, Lcom/opongo/blogapp/activities/CommentAddActivity;

    .line 296
    invoke-direct {v0, p0, v1}, Landroid/content/Intent;-><init>(Landroid/content/Context;Ljava/lang/Class;)V

    .line 298
    .local v0, intent:Landroid/content/Intent;
    const-string v1, "POSTID"

    iget v2, p0, Lcom/opongo/blogapp/activities/CommentsListActivity;->postid:I

    invoke-virtual {v0, v1, v2}, Landroid/content/Intent;->putExtra(Ljava/lang/String;I)Landroid/content/Intent;

    .line 299
    const-string v1, "COMMENTS"

    iget-object v2, p0, Lcom/opongo/blogapp/activities/CommentsListActivity;->comments:Ljava/util/ArrayList;

    invoke-virtual {v0, v1, v2}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/io/Serializable;)Landroid/content/Intent;

    .line 300
    invoke-virtual {p0, v0}, Lcom/opongo/blogapp/activities/CommentsListActivity;->startActivity(Landroid/content/Intent;)V

    .line 301
    return-void
.end method


# virtual methods
.method public onCreate(Landroid/os/Bundle;)V
    .locals 5
    .parameter "savedInstanceState"

    .prologue
    .line 57
    invoke-super {p0, p1}, Landroid/app/ListActivity;->onCreate(Landroid/os/Bundle;)V

    .line 59
    const v1, 0x7f030005

    invoke-virtual {p0, v1}, Lcom/opongo/blogapp/activities/CommentsListActivity;->setContentView(I)V

    .line 62
    invoke-virtual {p0}, Lcom/opongo/blogapp/activities/CommentsListActivity;->getIntent()Landroid/content/Intent;

    move-result-object v1

    invoke-virtual {v1}, Landroid/content/Intent;->getExtras()Landroid/os/Bundle;

    move-result-object v0

    .line 65
    .local v0, extras:Landroid/os/Bundle;
    if-nez v0, :cond_0

    .line 66
    invoke-direct {p0}, Lcom/opongo/blogapp/activities/CommentsListActivity;->showGenericAlert()V

    .line 133
    :goto_0
    return-void

    .line 71
    :cond_0
    const-string v1, "POSTID"

    invoke-virtual {v0, v1}, Landroid/os/Bundle;->getInt(Ljava/lang/String;)I

    move-result v1

    iput v1, p0, Lcom/opongo/blogapp/activities/CommentsListActivity;->postid:I

    .line 74
    iget v1, p0, Lcom/opongo/blogapp/activities/CommentsListActivity;->postid:I

    const/4 v2, -0x1

    if-ne v1, v2, :cond_1

    .line 75
    invoke-direct {p0}, Lcom/opongo/blogapp/activities/CommentsListActivity;->showGenericAlert()V

    goto :goto_0

    .line 79
    :cond_1
    new-instance v1, Lcom/opongo/blogapp/manager/APIManager;

    invoke-direct {v1, p0}, Lcom/opongo/blogapp/manager/APIManager;-><init>(Landroid/content/Context;)V

    iput-object v1, p0, Lcom/opongo/blogapp/activities/CommentsListActivity;->apiManager:Lcom/opongo/blogapp/manager/APIManager;

    .line 81
    new-instance v1, Ljava/util/ArrayList;

    invoke-direct {v1}, Ljava/util/ArrayList;-><init>()V

    iput-object v1, p0, Lcom/opongo/blogapp/activities/CommentsListActivity;->comments:Ljava/util/ArrayList;

    .line 83
    new-instance v1, Lcom/opongo/blogapp/adapter/CommentViewAdapter;

    const v2, 0x7f030006

    iget-object v3, p0, Lcom/opongo/blogapp/activities/CommentsListActivity;->comments:Ljava/util/ArrayList;

    invoke-direct {v1, p0, p0, v2, v3}, Lcom/opongo/blogapp/adapter/CommentViewAdapter;-><init>(Landroid/app/Activity;Landroid/content/Context;ILjava/util/ArrayList;)V

    iput-object v1, p0, Lcom/opongo/blogapp/activities/CommentsListActivity;->mAdapter:Lcom/opongo/blogapp/adapter/CommentViewAdapter;

    .line 88
    iget-object v1, p0, Lcom/opongo/blogapp/activities/CommentsListActivity;->mAdapter:Lcom/opongo/blogapp/adapter/CommentViewAdapter;

    invoke-virtual {p0, v1}, Lcom/opongo/blogapp/activities/CommentsListActivity;->setListAdapter(Landroid/widget/ListAdapter;)V

    .line 90
    const-string v1, "layout_inflater"

    invoke-virtual {p0, v1}, Lcom/opongo/blogapp/activities/CommentsListActivity;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Landroid/view/LayoutInflater;

    .line 91
    const v2, 0x7f03000b

    const/4 v3, 0x0

    const/4 v4, 0x0

    invoke-virtual {v1, v2, v3, v4}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;Z)Landroid/view/View;

    move-result-object v1

    .line 90
    iput-object v1, p0, Lcom/opongo/blogapp/activities/CommentsListActivity;->footerView:Landroid/view/View;

    .line 92
    invoke-virtual {p0}, Lcom/opongo/blogapp/activities/CommentsListActivity;->getListView()Landroid/widget/ListView;

    move-result-object v1

    iget-object v2, p0, Lcom/opongo/blogapp/activities/CommentsListActivity;->footerView:Landroid/view/View;

    invoke-virtual {v1, v2}, Landroid/widget/ListView;->addFooterView(Landroid/view/View;)V

    .line 94
    iget-object v1, p0, Lcom/opongo/blogapp/activities/CommentsListActivity;->footerView:Landroid/view/View;

    new-instance v2, Lcom/opongo/blogapp/activities/CommentsListActivity$1;

    invoke-direct {v2, p0}, Lcom/opongo/blogapp/activities/CommentsListActivity$1;-><init>(Lcom/opongo/blogapp/activities/CommentsListActivity;)V

    invoke-virtual {v1, v2}, Landroid/view/View;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    .line 101
    const-string v1, "TABLENAME"

    invoke-virtual {v0, v1}, Landroid/os/Bundle;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    iput-object v1, p0, Lcom/opongo/blogapp/activities/CommentsListActivity;->tableName:Ljava/lang/String;

    .line 102
    new-instance v1, Lcom/opongo/blogapp/manager/DatabaseManager;

    iget-object v2, p0, Lcom/opongo/blogapp/activities/CommentsListActivity;->tableName:Ljava/lang/String;

    invoke-direct {v1, p0, v2}, Lcom/opongo/blogapp/manager/DatabaseManager;-><init>(Landroid/content/Context;Ljava/lang/String;)V

    iput-object v1, p0, Lcom/opongo/blogapp/activities/CommentsListActivity;->dbManager:Lcom/opongo/blogapp/manager/DatabaseManager;

    .line 104
    new-instance v1, Lcom/opongo/blogapp/activities/CommentsListActivity$2;

    invoke-direct {v1, p0}, Lcom/opongo/blogapp/activities/CommentsListActivity$2;-><init>(Lcom/opongo/blogapp/activities/CommentsListActivity;)V

    iput-object v1, p0, Lcom/opongo/blogapp/activities/CommentsListActivity;->receiver:Landroid/content/BroadcastReceiver;

    .line 118
    iget-object v1, p0, Lcom/opongo/blogapp/activities/CommentsListActivity;->receiver:Landroid/content/BroadcastReceiver;

    new-instance v2, Landroid/content/IntentFilter;

    .line 119
    const-string v3, "com.opongo.comment_add_with_parent"

    invoke-direct {v2, v3}, Landroid/content/IntentFilter;-><init>(Ljava/lang/String;)V

    .line 118
    invoke-virtual {p0, v1, v2}, Lcom/opongo/blogapp/activities/CommentsListActivity;->registerReceiver(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent;

    .line 121
    new-instance v1, Lcom/opongo/blogapp/activities/CommentsListActivity$3;

    invoke-direct {v1, p0}, Lcom/opongo/blogapp/activities/CommentsListActivity$3;-><init>(Lcom/opongo/blogapp/activities/CommentsListActivity;)V

    iput-object v1, p0, Lcom/opongo/blogapp/activities/CommentsListActivity;->receiver2:Landroid/content/BroadcastReceiver;

    .line 131
    iget-object v1, p0, Lcom/opongo/blogapp/activities/CommentsListActivity;->receiver2:Landroid/content/BroadcastReceiver;

    new-instance v2, Landroid/content/IntentFilter;

    .line 132
    const-string v3, "com.opongo.comment_added"

    invoke-direct {v2, v3}, Landroid/content/IntentFilter;-><init>(Ljava/lang/String;)V

    .line 131
    invoke-virtual {p0, v1, v2}, Lcom/opongo/blogapp/activities/CommentsListActivity;->registerReceiver(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent;

    goto/16 :goto_0
.end method

.method public onCreateOptionsMenu(Landroid/view/Menu;)Z
    .locals 2
    .parameter "menu"

    .prologue
    .line 222
    invoke-virtual {p0}, Lcom/opongo/blogapp/activities/CommentsListActivity;->getMenuInflater()Landroid/view/MenuInflater;

    move-result-object v0

    const v1, 0x7f0e0002

    invoke-virtual {v0, v1, p1}, Landroid/view/MenuInflater;->inflate(ILandroid/view/Menu;)V

    .line 223
    invoke-super {p0, p1}, Landroid/app/ListActivity;->onCreateOptionsMenu(Landroid/view/Menu;)Z

    move-result v0

    return v0
.end method

.method public onDestroy()V
    .locals 1

    .prologue
    .line 285
    iget-object v0, p0, Lcom/opongo/blogapp/activities/CommentsListActivity;->receiver:Landroid/content/BroadcastReceiver;

    invoke-virtual {p0, v0}, Lcom/opongo/blogapp/activities/CommentsListActivity;->unregisterReceiver(Landroid/content/BroadcastReceiver;)V

    .line 286
    iget-object v0, p0, Lcom/opongo/blogapp/activities/CommentsListActivity;->receiver2:Landroid/content/BroadcastReceiver;

    invoke-virtual {p0, v0}, Lcom/opongo/blogapp/activities/CommentsListActivity;->unregisterReceiver(Landroid/content/BroadcastReceiver;)V

    .line 287
    iget-object v0, p0, Lcom/opongo/blogapp/activities/CommentsListActivity;->dbManager:Lcom/opongo/blogapp/manager/DatabaseManager;

    if-eqz v0, :cond_0

    .line 288
    iget-object v0, p0, Lcom/opongo/blogapp/activities/CommentsListActivity;->dbManager:Lcom/opongo/blogapp/manager/DatabaseManager;

    invoke-virtual {v0}, Lcom/opongo/blogapp/manager/DatabaseManager;->close()V

    .line 290
    :cond_0
    iget-object v0, p0, Lcom/opongo/blogapp/activities/CommentsListActivity;->mAdapter:Lcom/opongo/blogapp/adapter/CommentViewAdapter;

    invoke-virtual {v0}, Lcom/opongo/blogapp/adapter/CommentViewAdapter;->stopImgLoaderThread()V

    .line 291
    const/4 v0, 0x0

    invoke-virtual {p0, v0}, Lcom/opongo/blogapp/activities/CommentsListActivity;->setListAdapter(Landroid/widget/ListAdapter;)V

    .line 292
    invoke-super {p0}, Landroid/app/ListActivity;->onDestroy()V

    .line 293
    return-void
.end method

.method public onOptionsItemSelected(Landroid/view/MenuItem;)Z
    .locals 2
    .parameter "item"

    .prologue
    .line 304
    invoke-interface {p1}, Landroid/view/MenuItem;->getItemId()I

    move-result v0

    const v1, 0x7f08005f

    if-ne v0, v1, :cond_0

    .line 305
    invoke-direct {p0}, Lcom/opongo/blogapp/activities/CommentsListActivity;->writeComment()V

    .line 306
    const/4 v0, 0x1

    .line 308
    :goto_0
    return v0

    :cond_0
    invoke-super {p0, p1}, Landroid/app/ListActivity;->onOptionsItemSelected(Landroid/view/MenuItem;)Z

    move-result v0

    goto :goto_0
.end method

.method protected onPause()V
    .locals 2

    .prologue
    .line 262
    iget-object v0, p0, Lcom/opongo/blogapp/activities/CommentsListActivity;->downloadComments:Landroid/os/AsyncTask;

    if-eqz v0, :cond_0

    .line 263
    iget-object v0, p0, Lcom/opongo/blogapp/activities/CommentsListActivity;->downloadComments:Landroid/os/AsyncTask;

    const/4 v1, 0x1

    invoke-virtual {v0, v1}, Landroid/os/AsyncTask;->cancel(Z)Z

    .line 264
    :cond_0
    invoke-super {p0}, Landroid/app/ListActivity;->onPause()V

    .line 265
    return-void
.end method

.method protected onResume()V
    .locals 2

    .prologue
    .line 250
    iget-object v0, p0, Lcom/opongo/blogapp/activities/CommentsListActivity;->comments:Ljava/util/ArrayList;

    invoke-virtual {v0}, Ljava/util/ArrayList;->size()I

    move-result v0

    if-nez v0, :cond_0

    .line 251
    new-instance v0, Lcom/opongo/blogapp/activities/CommentsListActivity$downloadCommentsAsyncTask;

    const/4 v1, 0x0

    invoke-direct {v0, p0, v1}, Lcom/opongo/blogapp/activities/CommentsListActivity$downloadCommentsAsyncTask;-><init>(Lcom/opongo/blogapp/activities/CommentsListActivity;Lcom/opongo/blogapp/activities/CommentsListActivity$downloadCommentsAsyncTask;)V

    const/4 v1, 0x0

    new-array v1, v1, [Ljava/lang/Void;

    invoke-virtual {v0, v1}, Lcom/opongo/blogapp/activities/CommentsListActivity$downloadCommentsAsyncTask;->execute([Ljava/lang/Object;)Landroid/os/AsyncTask;

    move-result-object v0

    iput-object v0, p0, Lcom/opongo/blogapp/activities/CommentsListActivity;->downloadComments:Landroid/os/AsyncTask;

    .line 257
    :goto_0
    invoke-super {p0}, Landroid/app/ListActivity;->onResume()V

    .line 258
    return-void

    .line 253
    :cond_0
    invoke-direct {p0}, Lcom/opongo/blogapp/activities/CommentsListActivity;->reloadComments()V

    goto :goto_0
.end method
